<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /* function unique(arr = []) {
        let newArr = [];
        arr.forEach((v) => {
          if (newArr.includes(v) === false) {
            newArr.push(v);
          }
        });
        return newArr;
      } */
      function unique(arr = []) {
        let obj = {};
        let newArr = [];
        arr.forEach((v) => (obj[v] = ""));
        for (let i in obj) newArr.push(i);
        return newArr;
      }
      let strings = [
        "Hare",
        "Krishna",
        "Hare",
        "Krishna",
        "Krishna",
        "Krishna",
        "Hare",
        "Hare",
        ":-O",
      ];
      console.log(unique(strings)); // Hare, Krishna, :-O
    </script>
  </body>
</html>
